﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ArgusLib
{
	public class IndexedProperty<TProperty, TIndex>
	{
		public delegate TProperty GetHandler(TIndex index);
		public delegate void SetHandler(TIndex index, TProperty value);

		GetHandler getHandler;
		SetHandler setHandler;

		public IndexedProperty(GetHandler getHandler, SetHandler setHandler)
		{
			this.getHandler = getHandler;
			this.setHandler = setHandler;
		}

		public TProperty this[TIndex index]
		{
			get { return this.getHandler(index); }
			set { this.setHandler(index, value); }
		}
	}

	public class IndexedProperty<TProperty, TIndex1, TIndex2>
	{
		public delegate TProperty GetHandler(TIndex1 index1, TIndex2 index2);
		public delegate void SetHandler(TIndex1 index1, TIndex2 index2, TProperty value);

		GetHandler getHandler;
		SetHandler setHandler;

		public IndexedProperty(GetHandler getHandler, SetHandler setHandler)
		{
			this.getHandler = getHandler;
			this.setHandler = setHandler;
		}

		public TProperty this[TIndex1 index1, TIndex2 index2]
		{
			get { return this.getHandler(index1, index2); }
			set { this.setHandler(index1, index2, value); }
		}
	}

	public class IndexedProperty<TProperty, TIndex1, TIndex2, TIndex3>
	{
		public delegate TProperty GetHandler(TIndex1 index1, TIndex2 index2, TIndex3 index3);
		public delegate void SetHandler(TIndex1 index1, TIndex2 index2, TIndex3 index3, TProperty value);

		GetHandler getHandler;
		SetHandler setHandler;

		public IndexedProperty(GetHandler getHandler, SetHandler setHandler)
		{
			this.getHandler = getHandler;
			this.setHandler = setHandler;
		}

		public TProperty this[TIndex1 index1, TIndex2 index2, TIndex3 index3]
		{
			get { return this.getHandler(index1, index2, index3); }
			set { this.setHandler(index1, index2, index3, value); }
		}
	}

	public class IndexedPropertyGet<TProperty, TIndex>
	{
		public delegate TProperty GetHandler(TIndex index);

		GetHandler getHandler;

		public IndexedPropertyGet(GetHandler getHandler)
		{
			this.getHandler = getHandler;
		}

		public TProperty this[TIndex index]
		{
			get { return this.getHandler(index); }
		}
	}

	public class IndexedPropertyGet<TProperty, TIndex1, TIndex2>
	{
		public delegate TProperty GetHandler(TIndex1 index1, TIndex2 index2);

		GetHandler getHandler;

		public IndexedPropertyGet(GetHandler getHandler)
		{
			this.getHandler = getHandler;
		}

		public TProperty this[TIndex1 index1, TIndex2 index2]
		{
			get { return this.getHandler(index1, index2); }
		}
	}

	public class IndexedPropertyGet<TProperty, TIndex1, TIndex2, TIndex3>
	{
		public delegate TProperty GetHandler(TIndex1 index1, TIndex2 index2, TIndex3 index3);

		GetHandler getHandler;

		public IndexedPropertyGet(GetHandler getHandler)
		{
			this.getHandler = getHandler;
		}

		public TProperty this[TIndex1 index1, TIndex2 index2, TIndex3 index3]
		{
			get { return this.getHandler(index1, index2, index3); }
		}
	}
}
